<template>
  <div>
    <el-button @click="increment">增加</el-button>
    <el-button @click="decrement">减少</el-button>
    <el-button @click="incrementAsync">延时增加</el-button>
    <el-button @click="getData">获取接口实例</el-button>
    <p>{{ count }}</p>
    <p>{{ isEvenOrOdd }}</p>
    <p>{{ res }}</p>
  </div>
</template>

<script>
import { mapGetters, mapActions } from "vuex";
import { getInfoApi } from "@/api/test";
export default {
  name: "testVuex",
  data() {
    return {
      res: "get data",
    };
  },
  computed: mapGetters(["count", "isEvenOrOdd"]),
  methods: {
    ...mapActions(["increment", "decrement", "incrementAsync"]),
    async getData() {
      let parmas = { postId: 1 };
      const res = await getInfoApi(parmas);
      this.res = res;
    },
  },
};
</script>
<style lang="scss" scoped></style>
